<template>
	<view class="container  pad-t-20 pad-b-80 bac-color-fff page">
        <view  class="flex align-center">
            <view>
                <image  src="@/static/icons/consult/pinglun.png" class="icon mar-t-5"></image>
            </view>
            <view class="flex-1 mar-l-10">
                <text class="font-size-20 font-bold font-color-333">用户评价记录</text>
            </view>
        </view>
		<!-- 用户评价 -->
		<block v-if="evaluate_list">
			<evaluate-list class="bac-color-fff mar-t-13" :range="evaluate_list"></evaluate-list>
		</block>
		<!-- 用户评价结束 -->
		<no-more v-if="index_page >= total_page" class="mar-t-15"></no-more>
	</view>
</template>

<script>
import { evaluatesList } from '@/utils/http'
import evaluateList from '@/components/evaluate-list'
export default {
	data() {
		return {
			type: '',
			id: '',
			index_page: 0,
			total_page: 1,
			evaluate_list: ''
		}
	},
	components: {
		evaluateList
	},
	methods: {
		getEvaluateList() {
			evaluatesList({
				type: 'consult_order',
				id: this.id,
				page: this.index_page+1
			}).then(res => {
				if (res) {
                    this.index_page = res.current_page
					this.total_page = res.last_page
					this.evaluate_list = [...this.evaluate_list, ...res.data]
				}
			})
		}
    },
    //上拉加载
	onReachBottom() {
		if (this.index_page < this.total_page) {
			this.getEvaluateList()
		}
	},
	onLoad(option) {
		this.type = option.type
		this.id = option.id
		this.getEvaluateList()
	}
}
</script>

<style>
</style>